package com.cq.xjms.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 成绩实体类
 * @author caiqiang
 * @version 1
 */
@Entity
@Table(name="Score")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@NamedQueries( {
	@NamedQuery(name = "Course.queryByCourseStu", query ="select s from Score s left join fetch s.course c where s.course.id=:courseId and s.student.id=:studentId"),
	@NamedQuery(name = "Score.queryByStudentId", query ="select s from Score s  where  s.student.id=:studentId"),
	@NamedQuery(name = "Score.queryById", query ="select s from Score s left join fetch s.course where s.id=:id")

})
public class Score extends BaseEntity
{
	private static final long serialVersionUID = 1539350453366775796L;
	public static final String COURSE_QUERYBYCOURSESTU="Course.queryByCourseStu";
	public static final String SCORE_QUERYBYID="Score.queryById";
	public static final String SCORE_QUERYBYSTUDENTID="Score.queryByStudentId";
	private double point;
	
	@ManyToOne
	private Student student;
	
	@ManyToOne
	private Course course;
	
	@Column(name = "CREATEDATE", nullable =false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate=new Date();
	
	@Column(name ="AVGPOINT",nullable=false)
	private double avgPoint;
	
	@Column(name ="CONPOINT",nullable=false)
	private double conPoint;
	
	@Column(name ="Mark",nullable=false)
	private int mark;
	
	public double getPoint() {
		return point;
	}

	public void setPoint(double point) {
		this.point = point;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	public double getAvgPoint() {
		return avgPoint;
	}

	public void setAvgPoint(double avgPoint) {
		this.avgPoint = avgPoint;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public int getMark() {
		return mark;
	}

	public void setMark(int mark) {
		this.mark = mark;
	}

	public double getConPoint() {
		return conPoint;
	}

	public void setConPoint(double conPoint) {
		this.conPoint = conPoint;
	}
	
	
}
